home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 4: GNU Archives / Linux Cubed Series 4 - GNU Archives.iso / gnu / inetutil.1 / inetutil / inetutils-1.1 / telnetd / termstat.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-07-22  |  17.2 KB  |  665 lines

  1. /*
  2.  * Copyright (c) 1989, 1993
  3.  *    The Regents of the University of California.  All rights reserved.
  4.  *
  5.  * Redistribution and use in source and binary forms, with or without
  6.  * modification, are permitted provided that the following conditions
  7.  * are met:
  8.  * 1. Redistributions of source code must retain the above copyright
  9.  *    notice, this list of conditions and the following disclaimer.
  10.  * 2. Redistributions in binary form must reproduce the above copyright
  11.  *    notice, this list of conditions and the following disclaimer in the
  12.  *    documentation and/or other materials provided with the distribution.
  13.  * 3. All advertising materials mentioning features or use of this software
  14.  *    must display the following acknowledgement:
  15.  *    This product includes software developed by the University of
  16.  *    California, Berkeley and its contributors.
  17.  * 4. Neither the name of the University nor the names of its contributors
  18.  *    may be used to endorse or promote products derived from this software
  19.  *    without specific prior written permission.
  20.  *
  21.  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  22.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  23.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  24.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  25.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  26.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  27.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  28.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  29.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  30.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  31.  * SUCH DAMAGE.
  32.  */
  33.  
  34. #ifndef lint
  35. static char sccsid[] = "@(#)termstat.c    8.2 (Berkeley) 5/30/95";
  36. #endif /* not lint */
  37.  
  38. #ifdef HAVE_CONFIG_H
  39. #include <config.h>
  40. #endif
  41.  
  42. #include "telnetd.h"
  43.  
  44. /*
  45.  * local variables
  46.  */
  47. int def_tspeed = -1, def_rspeed = -1;
  48. #ifdef    TIOCSWINSZ
  49. int def_row = 0, def_col = 0;
  50. #endif
  51. #ifdef    LINEMODE
  52. static int _terminit = 0;
  53. #endif    /* LINEMODE */
  54.  
  55. #if    defined(CRAY2) && defined(UNICOS5)
  56. int    newmap = 1;    /* nonzero if \n maps to ^M^J */
  57. #endif
  58.  
  59. #ifdef    LINEMODE
  60. /*
  61.  * localstat
  62.  *
  63.  * This function handles all management of linemode.
  64.  *
  65.  * Linemode allows the client to do the local editing of data
  66.  * and send only complete lines to the server.  Linemode state is
  67.  * based on the state of the pty driver.  If the pty is set for
  68.  * external processing, then we can use linemode.  Further, if we
  69.  * can use real linemode, then we can look at the edit control bits
  70.  * in the pty to determine what editing the client should do.
  71.  *
  72.  * Linemode support uses the following state flags to keep track of
  73.  * current and desired linemode state.
  74.  *    alwayslinemode : true if -l was specified on the telnetd
  75.  *     command line.  It means to have linemode on as much as
  76.  *    possible.
  77.  *
  78.  *     lmodetype: signifies whether the client can
  79.  *    handle real linemode, or if use of kludgeomatic linemode
  80.  *    is preferred.  It will be set to one of the following:
  81.  *        REAL_LINEMODE : use linemode option
  82.  *        NO_KLUDGE : don't initiate kludge linemode.
  83.  *        KLUDGE_LINEMODE : use kludge linemode
  84.  *        NO_LINEMODE : client is ignorant of linemode
  85.  *
  86.  *    linemode, uselinemode : linemode is true if linemode
  87.  *    is currently on, uselinemode is the state that we wish
  88.  *    to be in.  If another function wishes to turn linemode
  89.  *    on or off, it sets or clears uselinemode.
  90.  *
  91.  *    editmode, useeditmode : like linemode/uselinemode, but
  92.  *    these contain the edit mode states (edit and trapsig).
  93.  *
  94.  * The state variables correspond to some of the state information
  95.  * in the pty.
  96.  *    linemode:
  97.  *        In real linemode, this corresponds to whether the pty
  98.  *        expects external processing of incoming data.
  99.  *        In kludge linemode, this more closely corresponds to the
  100.  *        whether normal processing is on or not.  (ICANON in
  101.  *        system V, or COOKED mode in BSD.)
  102.  *        If the -l option was specified (alwayslinemode), then
  103.  *        an attempt is made to force external processing on at
  104.  *        all times.
  105.  *
  106.  * The following heuristics are applied to determine linemode
  107.  * handling within the server.
  108.  *    1) Early on in starting up the server, an attempt is made
  109.  *       to negotiate the linemode option.  If this succeeds
  110.  *       then lmodetype is set to REAL_LINEMODE and all linemode
  111.  *       processing occurs in the context of the linemode option.
  112.  *    2) If the attempt to negotiate the linemode option failed,
  113.  *       and the "-k" (don't initiate kludge linemode) isn't set,
  114.  *       then we try to use kludge linemode.  We test for this
  115.  *       capability by sending "do Timing Mark".  If a positive
  116.  *       response comes back, then we assume that the client
  117.  *       understands kludge linemode (ech!) and the
  118.  *       lmodetype flag is set to KLUDGE_LINEMODE.
  119.  *    3) Otherwise, linemode is not supported at all and
  120.  *       lmodetype remains set to NO_LINEMODE (which happens
  121.  *       to be 0 for convenience).
  122.  *    4) At any time a command arrives that implies a higher
  123.  *       state of linemode support in the client, we move to that
  124.  *       linemode support.
  125.  *
  126.  * A short explanation of kludge linemode is in order here.
  127.  *    1) The heuristic to determine support for kludge linemode
  128.  *       is to send a do timing mark.  We assume that a client
  129.  *       that supports timing marks also supports kludge linemode.
  130.  *       A risky proposition at best.
  131.  *    2) Further negotiation of linemode is done by changing the
  132.  *       the server's state regarding SGA.  If server will SGA,
  133.  *       then linemode is off, if server won't SGA, then linemode
  134.  *       is on.
  135.  */
  136.     void
  137. localstat()
  138. {
  139.     void netflush();
  140.     int need_will_echo = 0;
  141.  
  142. #if    defined(CRAY2) && defined(UNICOS5)
  143.     /*
  144.      * Keep track of that ol' CR/NL mapping while we're in the
  145.      * neighborhood.
  146.      */
  147.     newmap = tty_isnewmap();
  148. #endif    /* defined(CRAY2) && defined(UNICOS5) */
  149.  
  150.     /*
  151.      * Check for state of BINARY options.
  152.      */
  153.     if (tty_isbinaryin()) {
  154.         if (his_want_state_is_wont(TELOPT_BINARY))
  155.             send_do(TELOPT_BINARY, 1);
  156.     } else {
  157.         if (his_want_state_is_will(TELOPT_BINARY))
  158.             send_dont(TELOPT_BINARY, 1);
  159.     }
  160.  
  161.     if (tty_isbinaryout()) {
  162.         if (my_want_state_is_wont(TELOPT_BINARY))
  163.             send_will(TELOPT_BINARY, 1);
  164.     } else {
  165.         if (my_want_state_is_will(TELOPT_BINARY))
  166.             send_wont(TELOPT_BINARY, 1);
  167.     }
  168.  
  169.     /*
  170.      * Check for changes to flow control if client supports it.
  171.      */
  172.     flowstat();
  173.  
  174.     /*
  175.      * Check linemode on/off state
  176.      */
  177.     uselinemode = tty_linemode();
  178.  
  179.     /*
  180.      * If alwayslinemode is on, and pty is changing to turn it off, then
  181.      * force linemode back on.
  182.      */
  183.     if (alwayslinemode && linemode && !uselinemode) {
  184.         uselinemode = 1;
  185.         tty_setlinemode(uselinemode);
  186.     }
  187.  
  188. #ifdef    ENCRYPTION
  189.     /*
  190.      * If the terminal is not echoing, but editing is enabled,
  191.      * something like password input is going to happen, so
  192.      * if we the other side is not currently sending encrypted
  193.      * data, ask the other side to start encrypting.
  194.      */
  195.     if (his_state_is_will(TELOPT_ENCRYPT)) {
  196.         static int enc_passwd = 0;
  197.         if (uselinemode && !tty_isecho() && tty_isediting()
  198.             && (enc_passwd == 0) && !decrypt_input) {
  199.             encrypt_send_request_start();
  200.             enc_passwd = 1;
  201.         } else if (enc_passwd) {
  202.             encrypt_send_request_end();
  203.             enc_passwd = 0;
  204.         }
  205.     }
  206. #endif    /* ENCRYPTION */
  207.  
  208.     /*
  209.      * Do echo mode handling as soon as we know what the
  210.      * linemode is going to be.
  211.      * If the pty has echo turned off, then tell the client that
  212.      * the server will echo.  If echo is on, then the server
  213.      * will echo if in character mode, but in linemode the
  214.      * client should do local echoing.  The state machine will
  215.      * not send anything if it is unnecessary, so don't worry
  216.      * about that here.
  217.      *
  218.      * If we need to send the WILL ECHO (because echo is off),
  219.      * then delay that until after we have changed the MODE.
  220.      * This way, when the user is turning off both editing
  221.      * and echo, the client will get editing turned off first.
  222.      * This keeps the client from going into encryption mode
  223.      * and then right back out if it is doing auto-encryption
  224.      * when passwords are being typed.
  225.      */
  226.     if (uselinemode) {
  227.         if (tty_isecho())
  228.             send_wont(TELOPT_ECHO, 1);
  229.         else
  230.             need_will_echo = 1;
  231. #ifdef    KLUDGELINEMODE
  232.         if (lmodetype == KLUDGE_OK)
  233.             lmodetype = KLUDGE_LINEMODE;
  234. #endif
  235.     }
  236.  
  237.     /*
  238.      * If linemode is being turned off, send appropriate
  239.      * command and then we're all done.
  240.      */
  241.      if (!uselinemode && linemode) {
  242. # ifdef    KLUDGELINEMODE
  243.         if (lmodetype == REAL_LINEMODE) {
  244. # endif    /* KLUDGELINEMODE */
  245.             send_dont(TELOPT_LINEMODE, 1);
  246. # ifdef    KLUDGELINEMODE
  247.         } else if (lmodetype == KLUDGE_LINEMODE)
  248.             send_will(TELOPT_SGA, 1);
  249. # endif    /* KLUDGELINEMODE */
  250.         send_will(TELOPT_ECHO, 1);
  251.         linemode = uselinemode;
  252.         goto done;
  253.     }
  254.  
  255. # ifdef    KLUDGELINEMODE
  256.     /*
  257.      * If using real linemode check edit modes for possible later use.
  258.      * If we are in kludge linemode, do the SGA negotiation.
  259.      */
  260.     if (lmodetype == REAL_LINEMODE) {
  261. # endif    /* KLUDGELINEMODE */
  262.         useeditmode = 0;
  263.         if (tty_isediting())
  264.             useeditmode |= MODE_EDIT;
  265.         if (tty_istrapsig())
  266.             useeditmode |= MODE_TRAPSIG;
  267.         if (tty_issofttab())
  268.             useeditmode |= MODE_SOFT_TAB;
  269.         if (tty_islitecho())
  270.             useeditmode |= MODE_LIT_ECHO;
  271. # ifdef    KLUDGELINEMODE
  272.     } else if (lmodetype == KLUDGE_LINEMODE) {
  273.         if (tty_isediting() && uselinemode)
  274.             send_wont(TELOPT_SGA, 1);
  275.         else
  276.             send_will(TELOPT_SGA, 1);
  277.     }
  278. # endif    /* KLUDGELINEMODE */
  279.  
  280.     /*
  281.      * Negotiate linemode on if pty state has changed to turn it on.
  282.      * Send appropriate command and send along edit mode, then all done.
  283.      */
  284.     if (uselinemode && !linemode) {
  285. # ifdef    KLUDGELINEMODE
  286.         if (lmodetype == KLUDGE_LINEMODE) {
  287.             send_wont(TELOPT_SGA, 1);
  288.         } else if (lmodetype == REAL_LINEMODE) {
  289. # endif    /* KLUDGELINEMODE */
  290.             send_do(TELOPT_LINEMODE, 1);
  291.             /* send along edit modes */
  292.             (void) sprintf(nfrontp, "%c%c%c%c%c%c%c", IAC, SB,
  293.                 TELOPT_LINEMODE, LM_MODE, useeditmode,
  294.                 IAC, SE);
  295.             nfrontp += 7;
  296.             editmode = useeditmode;
  297. # ifdef    KLUDGELINEMODE
  298.         }
  299. # endif    /* KLUDGELINEMODE */
  300.         linemode = uselinemode;
  301.         goto done;
  302.     }
  303.  
  304. # ifdef    KLUDGELINEMODE
  305.     /*
  306.      * None of what follows is of any value if not using
  307.      * real linemode.
  308.      */
  309.     if (lmodetype < REAL_LINEMODE)
  310.         goto done;
  311. # endif    /* KLUDGELINEMODE */
  312.  
  313.     if (linemode && his_state_is_will(TELOPT_LINEMODE)) {
  314.         /*
  315.          * If edit mode changed, send edit mode.
  316.          */
  317.          if (useeditmode != editmode) {
  318.             /*
  319.              * Send along appropriate edit mode mask.
  320.              */
  321.             (void) sprintf(nfrontp, "%c%c%c%c%c%c%c", IAC, SB,
  322.                 TELOPT_LINEMODE, LM_MODE, useeditmode,
  323.                 IAC, SE);
  324.             nfrontp += 7;
  325.             editmode = useeditmode;
  326.         }
  327.                             
  328.  
  329.         /*
  330.          * Check for changes to special characters in use.
  331.          */
  332.         start_slc(0);
  333.         check_slc();
  334.         (void) end_slc(0);
  335.     }
  336.  
  337. done:
  338.     if (need_will_echo)
  339.         send_will(TELOPT_ECHO, 1);
  340.     /*
  341.      * Some things should be deferred until after the pty state has
  342.      * been set by the local process.  Do those things that have been
  343.      * deferred now.  This only happens once.
  344.      */
  345.     if (_terminit == 0) {
  346.         _terminit = 1;
  347.         defer_terminit();
  348.     }
  349.  
  350.     netflush();
  351.     set_termbuf();
  352.     return;
  353.  
  354. }  /* end of localstat */
  355. #endif    /* LINEMODE */
  356.  
  357. /*
  358.  * flowstat
  359.  *
  360.  * Check for changes to flow control
  361.  */
  362.     void
  363. flowstat()
  364. {
  365.     if (his_state_is_will(TELOPT_LFLOW)) {
  366.         if (tty_flowmode() != flowmode) {
  367.             flowmode = tty_flowmode();
  368.             (void) sprintf(nfrontp, "%c%c%c%c%c%c",
  369.                     IAC, SB, TELOPT_LFLOW,
  370.                     flowmode ? LFLOW_ON : LFLOW_OFF,
  371.                     IAC, SE);
  372.             nfrontp += 6;
  373.         }
  374.         if (tty_restartany() != restartany) {
  375.             restartany = tty_restartany();
  376.             (void) sprintf(nfrontp, "%c%c%c%c%c%c",
  377.                     IAC, SB, TELOPT_LFLOW,
  378.                     restartany ? LFLOW_RESTART_ANY
  379.                            : LFLOW_RESTART_XON,
  380.                     IAC, SE);
  381.             nfrontp += 6;
  382.         }
  383.     }
  384. }
  385.  
  386. /*
  387.  * clientstat
  388.  *
  389.  * Process linemode related requests from the client.
  390.  * Client can request a change to only one of linemode, editmode or slc's
  391.  * at a time, and if using kludge linemode, then only linemode may be
  392.  * affected.
  393.  */
  394.     void
  395. clientstat(code, parm1, parm2)
  396.     register int code, parm1, parm2;
  397. {
  398.     void netflush();
  399.  
  400.     /*
  401.      * Get a copy of terminal characteristics.
  402.      */
  403.     init_termbuf();
  404.  
  405.     /*
  406.      * Process request from client. code tells what it is.
  407.      */
  408.     switch (code) {
  409. #ifdef    LINEMODE
  410.     case TELOPT_LINEMODE:
  411.         /*
  412.          * Don't do anything unless client is asking us to change
  413.          * modes.
  414.          */
  415.         uselinemode = (parm1 == WILL);
  416.         if (uselinemode != linemode) {
  417. # ifdef    KLUDGELINEMODE
  418.             /*
  419.              * If using kludge linemode, make sure that
  420.              * we can do what the client asks.
  421.              * We can not turn off linemode if alwayslinemode
  422.              * and the ICANON bit is set.
  423.              */
  424.             if (lmodetype == KLUDGE_LINEMODE) {
  425.                 if (alwayslinemode && tty_isediting()) {
  426.                     uselinemode = 1;
  427.                 }
  428.             }
  429.         
  430.             /*
  431.              * Quit now if we can't do it.
  432.              */
  433.             if (uselinemode == linemode)
  434.                 return;
  435.  
  436.             /*
  437.              * If using real linemode and linemode is being
  438.              * turned on, send along the edit mode mask.
  439.              */
  440.             if (lmodetype == REAL_LINEMODE && uselinemode)
  441. # else    /* KLUDGELINEMODE */
  442.             if (uselinemode)
  443. # endif    /* KLUDGELINEMODE */
  444.             {
  445.                 useeditmode = 0;
  446.                 if (tty_isediting())
  447.                     useeditmode |= MODE_EDIT;
  448.                 if (tty_istrapsig)
  449.                     useeditmode |= MODE_TRAPSIG;
  450.                 if (tty_issofttab())
  451.                     useeditmode |= MODE_SOFT_TAB;
  452.                 if (tty_islitecho())
  453.                     useeditmode |= MODE_LIT_ECHO;
  454.                 (void) sprintf(nfrontp, "%c%c%c%c%c%c%c", IAC,
  455.                     SB, TELOPT_LINEMODE, LM_MODE,
  456.                             useeditmode, IAC, SE);
  457.                 nfrontp += 7;
  458.                 editmode = useeditmode;
  459.             }
  460.  
  461.  
  462.             tty_setlinemode(uselinemode);
  463.  
  464.             linemode = uselinemode;
  465.  
  466.             if (!linemode)
  467.                 send_will(TELOPT_ECHO, 1);
  468.         }
  469.         break;
  470.     
  471.     case LM_MODE:
  472.         {
  473.         register int ack, changed;
  474.  
  475.         /*
  476.          * Client has sent along a mode mask.  If it agrees with
  477.          * what we are currently doing, ignore it; if not, it could
  478.          * be viewed as a request to change.  Note that the server
  479.          * will change to the modes in an ack if it is different from
  480.          * what we currently have, but we will not ack the ack.
  481.          */
  482.          useeditmode &= MODE_MASK;
  483.          ack = (useeditmode & MODE_ACK);
  484.          useeditmode &= ~MODE_ACK;
  485.  
  486.          if (changed = (useeditmode ^ editmode)) {
  487.             /*
  488.              * This check is for a timing problem.  If the
  489.              * state of the tty has changed (due to the user
  490.              * application) we need to process that info
  491.              * before we write in the state contained in the
  492.              * ack!!!  This gets out the new MODE request,
  493.              * and when the ack to that command comes back
  494.              * we'll set it and be in the right mode.
  495.              */
  496.             if (ack)
  497.                 localstat();
  498.             if (changed & MODE_EDIT)
  499.                 tty_setedit(useeditmode & MODE_EDIT);
  500.  
  501.             if (changed & MODE_TRAPSIG)
  502.                 tty_setsig(useeditmode & MODE_TRAPSIG);
  503.  
  504.             if (changed & MODE_SOFT_TAB)
  505.                 tty_setsofttab(useeditmode & MODE_SOFT_TAB);
  506.  
  507.             if (changed & MODE_LIT_ECHO)
  508.                 tty_setlitecho(useeditmode & MODE_LIT_ECHO);
  509.  
  510.             set_termbuf();
  511.  
  512.              if (!ack) {
  513.                  (void) sprintf(nfrontp, "%c%c%c%c%c%c%c", IAC,
  514.                     SB, TELOPT_LINEMODE, LM_MODE,
  515.                      useeditmode|MODE_ACK,
  516.                      IAC, SE);
  517.                  nfrontp += 7;
  518.              }
  519.          
  520.             editmode = useeditmode;
  521.         }
  522.  
  523.         break;
  524.  
  525.         }  /* end of case LM_MODE */
  526. #endif    /* LINEMODE */
  527.  
  528.     case TELOPT_NAWS:
  529. #ifdef    TIOCSWINSZ
  530.         {
  531.         struct winsize ws;
  532.  
  533.         def_col = parm1;
  534.         def_row = parm2;
  535. #ifdef    LINEMODE
  536.         /*
  537.          * Defer changing window size until after terminal is
  538.          * initialized.
  539.          */
  540.         if (terminit() == 0)
  541.             return;
  542. #endif    /* LINEMODE */
  543.  
  544.         /*
  545.          * Change window size as requested by client.
  546.          */
  547.  
  548.         ws.ws_col = parm1;
  549.         ws.ws_row = parm2;
  550.         (void) ioctl(pty, TIOCSWINSZ, (char *)&ws);
  551.         }
  552. #endif    /* TIOCSWINSZ */
  553.         
  554.         break;
  555.     
  556.     case TELOPT_TSPEED:
  557.         {
  558.         def_tspeed = parm1;
  559.         def_rspeed = parm2;
  560. #ifdef    LINEMODE
  561.         /*
  562.          * Defer changing the terminal speed.
  563.          */
  564.         if (terminit() == 0)
  565.             return;
  566. #endif    /* LINEMODE */
  567.         /*
  568.          * Change terminal speed as requested by client.
  569.          * We set the receive speed first, so that if we can't
  570.          * store seperate receive and transmit speeds, the transmit
  571.          * speed will take precedence.
  572.          */
  573.         tty_rspeed(parm2);
  574.         tty_tspeed(parm1);
  575.         set_termbuf();
  576.  
  577.         break;
  578.  
  579.         }  /* end of case TELOPT_TSPEED */
  580.  
  581.     default:
  582.         /* What? */
  583.         break;
  584.     }  /* end of switch */
  585.  
  586. #if    defined(CRAY2) && defined(UNICOS5)
  587.     /*
  588.      * Just in case of the likely event that we changed the pty state.
  589.      */
  590.     rcv_ioctl();
  591. #endif    /* defined(CRAY2) && defined(UNICOS5) */
  592.  
  593.     netflush();
  594.  
  595. }  /* end of clientstat */
  596.  
  597. #if    defined(CRAY2) && defined(UNICOS5)
  598.     void
  599. termstat()
  600. {
  601.     needtermstat = 1;
  602. }
  603.  
  604.     void
  605. _termstat()
  606. {
  607.     needtermstat = 0;
  608.     init_termbuf();
  609.     localstat();
  610.     rcv_ioctl();
  611. }
  612. #endif    /* defined(CRAY2) && defined(UNICOS5) */
  613.  
  614. #ifdef    LINEMODE
  615. /*
  616.  * defer_terminit
  617.  *
  618.  * Some things should not be done until after the login process has started
  619.  * and all the pty modes are set to what they are supposed to be.  This
  620.  * function is called when the pty state has been processed for the first time. 
  621.  * It calls other functions that do things that were deferred in each module.
  622.  */
  623.     void
  624. defer_terminit()
  625. {
  626.  
  627.     /*
  628.      * local stuff that got deferred.
  629.      */
  630.     if (def_tspeed != -1) {
  631.         clientstat(TELOPT_TSPEED, def_tspeed, def_rspeed);
  632.         def_tspeed = def_rspeed = 0;
  633.     }
  634.  
  635. #ifdef    TIOCSWINSZ
  636.     if (def_col || def_row) {
  637.         struct winsize ws;
  638.  
  639.         memset((char *)&ws, 0, sizeof(ws));
  640.         ws.ws_col = def_col;
  641.         ws.ws_row = def_row;
  642.         (void) ioctl(pty, TIOCSWINSZ, (char *)&ws);
  643.     }
  644. #endif
  645.  
  646.     /*
  647.      * The only other module that currently defers anything.
  648.      */
  649.     deferslc();
  650.  
  651. }  /* end of defer_terminit */
  652.  
  653. /*
  654.  * terminit
  655.  *
  656.  * Returns true if the pty state has been processed yet.
  657.  */
  658.     int
  659. terminit()
  660. {
  661.     return(_terminit);
  662.  
  663. }  /* end of terminit */
  664. #endif    /* LINEMODE */
  665.